<template>
	<view>
		<view style="position: relative;border-radius: 20upx;margin: 50upx 20upx;" v-for="(item, index) in res" :key="item.id">
			<image :src="'https://cx.mingmeijt.com' + item.level_img"
				style="width: 100%;border-radius: 20upx;"
				mode="widthFix"
				v-if="item.level_img">
			</image>
			<image :src="'https://cx.mingmeijt.com' + item.level_button"
				style="width: 200upx;position: absolute;top: 82%;left: 50%;transform: translate(-50%, -50%);"
				mode="widthFix"
				v-if="item.level_button"
				@click="tocart(item.id)">
			</image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res:[],
				user_id:'',
				
			};
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'user_id',
				success: (res) => {
					this.user_id = res.data
					this.setAjax()
				},
				fail: () => {
					uni.reLaunch({
						url: '/pages/login/login'
					})
				}
			});
		},
		methods:{
			setAjax(){
				uni.request({
					url: 'https://cx.mingmeijt.com/Api/Level/index',
					method: 'POST',
					data: {
						api_type: 'OrderStatus',
						session_id: uni.getStorageSync("sessionid")
					},
					header:{
						'Content-Type':'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync("sessionid")
					},
					success: (res) => {
						this.res = res.data.data
						uni.setStorage({
							key: 'viplevel',
							data: this.res
						})
					}
				})
				uni.hideLoading()
			},
			tocart(id) {
				uni.reLaunch({
					url: '../../../pages/cart/cart?vipid=' + id
				})
			},
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
		}
	}
</script>

<style>
	page {
		background: #FDFDFD;
	}
</style>
